"""

Collections模块含以下内容：
    1、ChainMap — Search Multiple Dictionaries
    2、Counter — Count Hashable Objects
    3、defaultdict — 查询dict不存在的key时，返回默认值
    4、deque — Double-Ended Queue
    5、namedtuple — Tuple Subclass with Named Fields
    6、OrderedDict — Remember the Order Keys are Added to a Dictionary
    7、collections.abc — Abstract Base Classes for Containers

"""
import collections as coll


#
s = [('yellow', 1), ('blue', 2), ('yellow', 3), ('blue', 4), ('red', 1)]
d = coll.defaultdict(list)
for k, v in s:
    d[k].append(v)
print(d)